package com.fourhats.model;

import java.math.BigDecimal;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="market")
public class Market extends com.fourhats.model.Entity {

	public Market() {
	}
	
	public Market(String name, String subtitle, String description,
			String address, int phone, String web, String email,
			String imagePath, boolean enable, boolean highlight,
			User user, BigDecimal latitude, BigDecimal longitude,
			String environmentAffect, String qualityImprovement,
			String organization, String recognitionReceived) {
		super();
		this.name = name;
		this.subtitle = subtitle;
		this.description = description;
		this.address = address;
		this.phone = phone;
		this.web = web;
		this.email = email;
		this.imagePath = imagePath;
		this.enable = enable;
		//TODO: Esto se hizo inicialmente para que aparezcan todos los mercados en la home, hay que cambiarlo mas adelante.
		this.highlight = true;
		//this.highlight = highlight;
		this.user = user;
		this.latitude = latitude;
		this.longitude = longitude;
		this.environmentAffect = environmentAffect;
		this.qualityImprovement = qualityImprovement;
		this.organization = organization;
		this.recognitionReceived = recognitionReceived;
	}

	@Column(name="name")
	private String name;
	
	@Column(name="subtitle")
	private String subtitle;
	
	@Column(name="description")
	private String description;
	
	@Column(name="address")
	private String address;
	
	@Column(name="phone")
	private int phone;
	
	@Column(name="web")
	private String web;
	
	@Column(name="email")
	private String email;
	
	@Column(name="imagePath")
	private String imagePath;
	
	@Column(name="enable")
	private boolean enable;

	@Column(name="highlight")
	private boolean highlight;
	
	@Column(name="latitude")
	private BigDecimal latitude;
	
	@Column(name="longitude")
	private BigDecimal longitude;
	
	@OneToMany(mappedBy="market")
    private Set<Product> products;
	
	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "userId")
	private User user;
	
	@Column(name="environmentAffect")
	private String environmentAffect;
	
	@Column(name="qualityImprovement")
	private String qualityImprovement;
	
	@Column(name="organization")
	private String organization;
	
	@Column(name="recognitionReceived")
	private String recognitionReceived;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSubtitle() {
		return subtitle;
	}

	public void setSubtitle(String subtitle) {
		this.subtitle = subtitle;
	}
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public int getPhone() {
		return phone;
	}

	public void setPhone(int phone) {
		this.phone = phone;
	}

	public String getWeb() {
		return web;
	}

	public void setWeb(String web) {
		this.web = web;
	}
	
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getImagePath() {
		return imagePath;
	}

	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}

	public boolean isEnable() {
		return enable;
	}

	public void setEnable(boolean enable) {
		this.enable = enable;
	}

	public boolean isHighlight() {
		return highlight;
	}

	public void setHighlight(boolean highlight) {
		this.highlight = highlight;
	}

	public Set<Product> getProducts() {
		return products;
	}

	public void setProducts(Set<Product> products) {
		this.products = products;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public BigDecimal getLatitude() {
		return latitude;
	}

	public void setLatitude(BigDecimal latitude) {
		this.latitude = latitude;
	}

	public BigDecimal getLongitude() {
		return longitude;
	}

	public void setLongitude(BigDecimal longitude) {
		this.longitude = longitude;
	}

	public String getEnvironmentAffect() {
		return environmentAffect;
	}

	public void setEnvironmentAffect(String environmentAffect) {
		this.environmentAffect = environmentAffect;
	}

	public String getQualityImprovement() {
		return qualityImprovement;
	}

	public void setQualityImprovement(String qualityImprovement) {
		this.qualityImprovement = qualityImprovement;
	}

	public String getOrganization() {
		return organization;
	}

	public void setOrganization(String organization) {
		this.organization = organization;
	}

	public String getRecognitionReceived() {
		return recognitionReceived;
	}

	public void setRecognitionReceived(String recognitionReceived) {
		this.recognitionReceived = recognitionReceived;
	}
}
